import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)


const routes = [
  //一级路由
  {
    path:"/login",
    component:()=>import("../pages/login/login.vue")
  },
  {
    path:"/register",
    component:()=>import("../pages/register/register.vue")
  },
  {
    path:"/sousuo",
    component:()=>import("../pages/sousuo/sousuo.vue")
  },
  {
    path:"/list",
    component:()=>import("../pages/list/list.vue")
  },
  {
    path:"/spxq/:id",
    component:()=>import("../pages/spxq/spxq.vue")
  },
  {
    path:"/qrdd",
    component:()=>import("../pages/qrdd/qrdd.vue")
  },
  {
    path:"/adddizhi",
    component:()=>import("../pages/adddizhi/adddizhi.vue")
  },
  {
    path:"/dizhiguanli",
    component:()=>import("../pages/dizhiguanli/dizhiguanli.vue")
  },
  {
    path:"/index",
    component:()=>import("../pages/index/index.vue"),
    //二级路由
    children:[
      {
        path:"shangcheng",
        component:()=>import("../pages/shangcheng-2/shangcheng.vue")
      },
      {
        path:"fenlei",
        component:()=>import("../pages/fenlei-2/fenlei.vue")
      },
      {
        path:"shop",
        component:()=>import("../pages/shop-2/shop.vue")
      },
      {
        path:"mine",
        component:()=>import("../pages/mine-2/mine.vue")
      },
      {
        path:"",
        redirect: "shangcheng"
      }
    ]
  },
  {
    path:"*",
    redirect: "/login"
  }
]

const router = new VueRouter({
  routes
})

export default router
